package com.jun.dao;

import com.jun.mapper.DepartmentMapper;
import com.jun.mapper.EmployeeMapper;
import com.jun.pojo.Department;
import com.jun.pojo.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

// 员工Dao
@Repository
public class EmployeeDao {

    @Autowired
    EmployeeMapper employeeMapper;
    @Autowired
    DepartmentMapper departmentMapper;
    // 增加一个员工
    public void save(Employee employee){
        employeeMapper.addEmp(employee);
    }
    // 修改员工信息
    public void update(Employee employee){
        employeeMapper.updateEmp(employee);
    }

    // 查询全部员工信息
    public Collection<Employee> getAll(){
        return employeeMapper.queryEmpList();
    }

    //通过id查询员工
    public Employee getEmployeeById(Integer id){
        return employeeMapper.queryEmpById(id);
    }

    //删除员工通过id
    public void delete(Integer id){
        employeeMapper.deleteEmp(id);
    }
}
